# 钟奕升
# 课堂练习20240412

def SayHello():
    print("hello, everyone")

def sum(m):
    s = 0
    for p in range(m+1):
        s += p
    return s

m = 100
s = sum(m)
print('0到100的相加的和：', s)

SayHello()
print('例题3-2-2 ---------------')

def fun(x,y):
    print("函数内部获得的的x，y分别是：", x, y)
    x = 1
    y = 2
    print("函数内部修改后的的x，y分别是：", x, y)

x = 100
y = 200
fun(x,y)
print("调用函数后函数外部的的x，y分别是：", x, y)

print('例题3-2-3 ---------------')

def fun(a,b):
    global x
    global y
    print("函数内部获得的的x，y分别是：", x, y)

    x = 1
    y = 2
    print("函数内部修改后的的x，y分别是：", x, y)

x = 100
y = 200
fun(x,y)
print("调用函数后函数外部的的x，y分别是：", x, y)

def A(x):
    global y
    y = 0
    x = 0
def B(x):
    global y
    y = 10
    x = 0
x = 1
y = 2
A(x)
B(x)
print(x,y)
print("The end")
